package club.baibin0558.jstudy.web.controller.common;

import club.baibin0558.jstudy.core.utils.ApiResult;
import club.baibin0558.jstudy.file.service.FileService;
import com.github.tobato.fastdfs.domain.FileInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件操作
 * @author 白彬
 */
@RestController
@RequestMapping("/file")
public class FileController {
    @Autowired
    private FileService fileService;

    @RequestMapping("/upload")
    public ApiResult upload (@RequestParam("file")MultipartFile multipartFile) {
        return ApiResult.success(fileService.upload(multipartFile));
    }
}
